# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.VersionHistory.V1.Model.Release do
  @moduledoc """
  A Release is owned by a Version. A Release contains information about the release(s) of its parent version. This includes when the release began and ended, as well as what percentage it was released at. If the version is released again, or if the serving percentage changes, it will create another release under the version.

  ## Attributes

  *   `fraction` (*type:* `float()`, *default:* `nil`) - Rollout fraction. This fraction indicates the fraction of people that should receive this version in this release. If the fraction is not specified in ReleaseManager, the API will assume fraction is 1.
  *   `fractionGroup` (*type:* `String.t`, *default:* `nil`) - Rollout fraction group. Only fractions with the same fraction_group are statistically comparable: there may be non-fractional differences between different fraction groups.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Release name. Format is "{product}/platforms/{platform}/channels/{channel}/versions/{version}/releases/{release}"
  *   `pinnable` (*type:* `boolean()`, *default:* `nil`) - Whether or not the release was available for version pinning.
  *   `serving` (*type:* `GoogleApi.VersionHistory.V1.Model.Interval.t`, *default:* `nil`) - Timestamp interval of when the release was live. If end_time is unspecified, the release is currently live.
  *   `version` (*type:* `String.t`, *default:* `nil`) - String containing just the version number. e.g. "84.0.4147.38"
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :fraction => float() | nil,
          :fractionGroup => String.t() | nil,
          :name => String.t() | nil,
          :pinnable => boolean() | nil,
          :serving => GoogleApi.VersionHistory.V1.Model.Interval.t() | nil,
          :version => String.t() | nil
        }

  field(:fraction)
  field(:fractionGroup)
  field(:name)
  field(:pinnable)
  field(:serving, as: GoogleApi.VersionHistory.V1.Model.Interval)
  field(:version)
end

defimpl Poison.Decoder, for: GoogleApi.VersionHistory.V1.Model.Release do
  def decode(value, options) do
    GoogleApi.VersionHistory.V1.Model.Release.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.VersionHistory.V1.Model.Release do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
